/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { Request, Response } from 'express';
import { ResponseItem, responseSuccess } from './../utils';
import Mock, { mock } from 'mockjs';

export default {
  'POST /jdk/deliveryWarning/list': (req: Request, res: Response, u: string) => {
    const result: ResponseItem = Mock.mock({
      code: 0,
      msg: '成功',
      data: {
        total: '3',
        'list|1-3': [
          {
            'id|+1': '@id',
            title_name: '@county(true)',
            source_brands: '美团配送、饿了吗、蜂鸟',
            'source_config|2-4': [
              {
                'source_brand_name|1': ['美团配送', '饿了吗', '蜂鸟'],
                'limit_kilometre|1': ['1', '2', '3'],
                'limit_price|1': ['1', '2', '3'],
              },
            ],
            update_at: '@date()',
          },
        ],
      },
    });
    return res.json(result);
  },
  'POST /jdk/deliveryWarning/search': (req: Request, res: Response, u: string) => {
    const result: ResponseItem = Mock.mock({
      code: 0,
      msg: '成功',
      'data|1-4': [
        {
          'source_brand|1': ['mt', 'elm', 'fn'],
          'source_brand_name|1': ['美团配送', '饿了吗', '蜂鸟'],
          'limit_kilometre|1': ['1', '2', '3'],
          'limit_price|1': ['1', '2', '3'],
        },
      ],
    });
    return res.json(result);
  },
  'POST /jdk/deliveryWarning/create': (req: Request, res: Response) => responseSuccess(req, res),

  'POST /jdk/voices/list': (req: Request, res: Response) => {
    res.send(
      mock({
        code: 0,
        msg: '成功',
        'data|1-20': [
          {
            id: '@id',
            key: '@id',
            name: '@cword(3,5)',
            version: '1',
            url: 'https://software.kuaidihelp.com/audio/yz/screen/out_sucess.wav',
          },
        ],
      }),
    );
  },
  'POST /jdk/voices/upload': (req: Request, res: Response) => {
    const result = {
      code: 0,
      msg: 'success',
      data: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
    };
    return res.json(result);
  },
  'POST /jdk/voices/updateDate': (req: Request, res: Response) => responseSuccess(req, res),
};
